<?php
defined( 'ABSPATH' ) || exit;

get_header();
$startTime=get_post_meta(get_the_ID(), "start_time", $single = true);
$endTime=get_post_meta(get_the_ID(), "end_time", $single = true);
$currentDate=wp_date("Y-m-d");
?>
<div class="container">
  <article>
	<div class="art_title">
	  <div class="art_date"><span><?php the_time('Y-m-');?></span><strong><?php the_time('d');?></strong></div>
	  <h1><?php the_title()?><i class="iconfont 
		<?php 
		if($startTime>$currentDate){
			echo 'icon-jingqingqidai " style="color:#44C662;font-weight:400;"';
		}elseif($endTime>=$currentDate){
			echo 'icon-afoot " style="color:red;font-weight:400;"';}else{
				echo 'icon-finished " style="color:#848484;font-weight:400;"';}?> ></i></h1>
	</div>
	<div class="art_content">
		<div class="col-sm-6 coupon_img">
			<div class="border-img">
				<img loading="lazy" src="<?php 
				if(has_post_thumbnail()){
					the_post_thumbnail_url();
					echo '" alt="';
					the_title();
					}else{
						echo '/images/no-pic-news.jpg" alt="赫思模特';
					}
				?>">
			</div>
		</div>
		<div class="col-sm-6 coupon_time">
			<div class="col-sm-6">
				<span>开始时间：<?php echo $startTime;?></span>
			</div>
			<div class="col-sm-6">
				<span>结束时间：<?php echo $endTime;?></span>
			</div>
		</div>
		<?php the_content();?>
	</div>
	<span style="font-size:20px;font-weight:500;" class="iconfont icon-eye">&nbsp;<?php echo getPostViews(get_the_ID()); ?></span>
  </article>
</div>

<?php
get_footer();
?>
#fff url(../images/loader.gif) no-repeat center center